package cn.vader.controller;

import cn.vader.vo.student;
import org.springframework.http.converter.json.GsonBuilderUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.management.modelmbean.ModelMBean;
import javax.servlet.http.HttpServletRequest;

@Controller
public class MyController {
    //    定义方法，处理请求
    @RequestMapping(value = "return-string-view1.do")//请求映射
    public String doReturnStringView1(HttpServletRequest request,String name, Integer age) {//doGet方法
//        使用此方法处理请求，叫做控制器方法
        //返回值 model 数据
//                view 视图
        System.out.println("执行了MyController类的 doReturnStringView1方法获得参数 name="+name+"age="+age);
        request.setAttribute("name",name);
        request.setAttribute("age",age);
        return "/WEB-INF/view/show.jsp";
    }

    @RequestMapping(value = "return-string-view2.do")//请求映射
    public String doReturnStringView2(HttpServletRequest request,String name, Integer age) {//doGet方法
//        使用此方法处理请求，叫做控制器方法
        //返回值 model 数据
//                view 视图
        System.out.println("执行了MyController类的 doReturnStringView1方法获得参数 name="+name+"age="+age);
        request.setAttribute("name",name);
        request.setAttribute("age",age);
        return "/WEB-INF/view/show.jsp";
    }



}

